﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
//using ComponentArt.Silverlight.UI.Navigation;
using System.Collections.Generic;
using System.Windows.Media.Imaging;

namespace MapEditor
{
    public class Utils
    {

        public static TreeViewItem CreateOpacityTree()
        {
            TreeViewItem parentNode = new TreeViewItem();

            TreeViewItem childNode = new TreeViewItem();
            childNode.Tag = null;
            childNode.Header = "Clear";
            parentNode.Items.Add(childNode);

            foreach(OpacityResource opacityRes in OpacityMasksManager.OpacityMasks)
            {
                childNode = new TreeViewItem();
                childNode.Tag = opacityRes;
                childNode.Header = opacityRes.Name;
                parentNode.Items.Add(childNode);
            }

            return parentNode;
        }

        public static TreeViewItem CreateObjectTemplateTree(List<SLGameEngine.ObjectBase> gameObjects, Type type)
        {
            TreeViewItem parentNode = new TreeViewItem();

            for (int i = 0; i < gameObjects.Count; i++)
            {
                if (type == gameObjects[i].GetType())
                {
                    TreeViewItem childNode = new TreeViewItem();
                    childNode.Tag = gameObjects[i];
                    childNode.Header = gameObjects[i].ObjectName;
                    parentNode.Items.Add(childNode);
                }
            }

            return parentNode;
        }
    }
}
